package com.glodon.paas.account.dao.mongo;

import java.util.List;

import com.google.code.morphia.DatastoreImpl;
import com.google.code.morphia.Morphia;
import com.mongodb.Mongo;

@SuppressWarnings("all")
public class MongoDataStore extends DatastoreImpl {
	//private final  Logger logger = LoggerFactory.getLogger(this.getClass());

	private List<Class> entityClasses;

	public MongoDataStore(Morphia morphia, Mongo mongo) {
		super(morphia, mongo);
	}

	public MongoDataStore(Morphia morphia, Mongo mongo, String dbName,
			String username, char[] password) {
		super(morphia, mongo, dbName, username, password);
	}

	public MongoDataStore(Morphia morphia, Mongo mongo, String dbName) {
		super(morphia, mongo, dbName);
	}

	public void setEntityClasses(List<Class> entityClasses) {
		this.entityClasses = entityClasses;
	}

	/**
	 * 
	 * 初始化相关映射类
	 */
	public void init() {
		if (this.entityClasses != null && !this.entityClasses.isEmpty()) {
			for (Class entityClass : entityClasses) {
				this.getMapper().addMappedClass(entityClass);
			}
		}
	}

}
